
<!--
 * @Author: wang_sheshe
 * @Date: 2021-05-17 15:04:17
 * @LastEditTime: 2021-07-30 08:29:17
 * @Description: 巡视任务详情
-->
<template>
	<article class="bg_4dbfae tourTaskPage">
		<!-- 头组件 -->
        <van-nav-bar title="巡视详情" left-text="" left-arrow @click-left="back" fixed>
			<template slot="right">
				<div class="parent-circle">
					<div class="child-circle"></div>
				</div>
            </template>
        </van-nav-bar>
        <!-- content -->
		<van-row style="flex: 1; overflow: auto;">
			<van-field 
				label="天气"  
				readonly 
				required  
				v-model="taskDetail.weather"
			/>
			<van-field 
				label="气温(℃)" 
				required 
				readonly 
				v-model="taskDetail.airTemperature" 
			/>
			<van-field 
				label="温湿度(%)" 
				required 
				readonly 
				:border="false"  
				v-model="taskDetail.humiture" 
			/>
            <van-field 
				label="风速" 
				required 
				readonly 
				:border="false"  
				v-model="taskDetail.windSpeed" 
			/>
			
			<van-field 
				label="开始时间" 
				required readonly 
				maxlength="25" 
				:border="false" 
				v-model="taskDetail.patrolStartTime"
			/>
			<van-field 
				label="结束时间" 
				required readonly 
				maxlength="25" 
				:border="false" 
				v-model="taskDetail.patrolEndTime"
			/>
			<!-- <div class="lineGray"></div> -->
			<van-field 
				label="巡视人员" 
				maxlength="64"  
				readonly
                required 
				:border="false" 
				v-model.trim="taskDetail.inspectUserName"/>

			<van-field 
				label="巡视结果" 
				required
				readonly
                :border="false" 
				v-model.trim="taskDetail.patrolResult"/>
			<div class="lineGray"></div>

			<van-cell :border="false" title="附件：">
				<template v-if="taskDetail.attachId" slot="default">
					<van-image @click="download" width="40" height="40" :src="icon.pic"/>
				</template>
			</van-cell>
    	</van-row>
	</article>
</template>

<script type="text/javascript">
	import Util from "@/utils/util" 
	import {getTourTaskDetail} from '../../api/tourTask';
	export default {
		name: 'DefectManage',
		data() {
			return {
				taskDetail:{},//任务详情
				icon: {
					pic: require("@/assets/img/mainIndex/defect.png")
				},
			}
		},
		methods: {
			/**
			 * 返回
			 */
			back(){
				history.go(-1)
			},
			//下载附件
			download() {

			},
			/**
			* @description: 渲染巡视任务
			* @param {*} taskInfo
			* @return {*}
			*/
			renderData(taskInfo) {
				//天气
				this.taskDetail.weather  = taskInfo.weather;
				//气温
				this.taskDetail.airTemperature = taskInfo.airTemperature;
				//温湿度
				this.taskDetail.humiture = taskInfo.humiture;
				//巡视人员
				this.taskDetail.inspectUserName = taskInfo.userList.map(item => item.patrolStaffName).join(",");
				//开始时间
				this.taskDetail.patrolStartTime = 
				Util.DateUtil.getFormatDateByLong(taskInfo.patrolStartTime,'yyyy-MM-dd hh:mm')
				//结束时间
				this.taskDetail.patrolEndTime = Util.DateUtil.getFormatDateByLong(taskInfo.patrolEndTime,'yyyy-MM-dd hh:mm')
				//巡视结论
				this.taskDetail.inspectResult = taskInfo.inspectResult;
			},
		},

		mounted() {
			
		},
		
		created() {
			this.taskDetail = this.$route.params.taskInfo;//任务数据
			this.renderData(this.taskDetail);
		},
		
	}
</script>

<style scoped>
	article {
		display: flex;
		flex-direction: column;
		height: 100vh;
        font-family: 微软雅黑;
        background: #ffffff;
	}
	.active{
		color: #36BDA6 !important;
		background: #ECF6F4 !important;
	}
	.van-nav-bar__text,.van-nav-bar .van-icon{
		color: #333333;
    }
    .van-button--default {
        margin-right: 20px !important;
        width: 80px;
    }
    .van-button--primary {
		background-color: #17B49B;
        border: 0.02667rem solid #17B49B;
        color: white;
		width: 138px;
        margin: 0 auto;
    }
	.templateDiv{
		display: flex;
		justify-content: space-between;
		padding: 10px 15px;
	}
	.van-checkbox-part{
		display: inline;margin-right: 15px;
	}
	input{
        width: calc(100% - 20px);
        margin: 0px 10px;
        box-sizing: border-box;
		height: 60px;
		border: 1px solid #E2E2E2;
		border-radius: 3px;
    }
</style>